package com.qiguliuxing.dts.merchant.support;

/**
 * 返回码定义
 * 
 * @author qiguliuxing
 * @since 1.0.0
 * @QQ 623659388
 * 
 */
public enum MerchantResponseCode {

	ADMIN_INVALID_NAME(600, "管理员名称不符合规定"),
	ADMIN_INVALID_PASSWORD(601, "管理员密码长度不能小于6"),
	ADMIN_NAME_EXIST(602, "管理员已存在或用户名已被其他商户占用"),
	ADMIN_INVALID_ACCOUNT_OR_PASSWORD(605, "用户帐号或密码不正确"),
	ADMIN_LOCK_ACCOUNT(606, "用户帐号已锁定不可用"),
	ADMIN_INVALID_AUTH(607, "认证失败"),
	GOODS_UPDATE_NOT_ALLOWED(610, "商品已经在未支付订单中，不能修改"),
	GOODS_NAME_EXIST(611, "商品名已经存在"),
	NO_AVAILABLE_AMOUNT(617,"账号可用金额不足，无法继续操作资金"),
	REFUND_AMOUNT_BEYOND(618, "申请的退款金额超出订单付款金额"),
	ORDER_REFUND_OP_FAILED(619, "订单退款操作失败"),
	ORDER_CONFIRM_NOT_ALLOWED(620, "当前订单状态不能确认收货"),
	ORDER_REFUND_FAILED(621, "当前订单状态不能退款"),
	ORDER_REPLY_EXIST(622, "订单商品已回复！"),
	ADMIN_INVALID_OLD_PASSWORD(623, "原始密码不正确！"),

	INVALID_CURR_MERCHANT(630, "非当前商户数据，无法更改"),
	WITHDRAW_AMOUNT_BEYOND(631, "提现金额超出范围！"),
	WITHDRAW_NO_DEFAULT_ACCOUNT(632, "尚未配置默认提现账号！"),
	WITHDRAW_ACCOUNT_NO_CONFIG(633, "当前类型的提现账号未配置！"),

	ROLE_NAME_EXIST(640, "角色已经存在"),
	ROLE_SUPER_SUPERMISSION(641, "当前角色的超级权限不能变更"),
	ARTICLE_NAME_EXIST(642,"公告或通知文章已经存在"),
	AUTH_CAPTCHA_FREQUENCY(643,"验证码请求过于频繁"),
	AUTH_CAPTCHA_ERROR(644,"验证码错误"),
	AUTH_CAPTCHA_EXPIRED(645,"验证码过期"),
	ROLE_NOT_ALLOWED_UPDATE(646, "内置角色,不允许变更"),
	ROLE_NOT_ALLOWED_DELETE(647, "内置角色,不允许删除"),

	AUTH_INVALID_MOBILE(707, "手机号格式不正确"),
	DISCOUNT_BEYOND_PRICE(801,"折扣不能超过商品金额"),
	NOT_ALLOW_REPLY_SELF(901,"不能回复自己发表的评论或回复"),

	EXIST_SECKILL_ACTIVE(701,"同一个商品,同时间段,同批次,不能配置多个活动"),
	SECKILL_ACTIVE_RUN(702,"秒杀活动正在进行,不能编辑"),

	ADMIN_INVALID_MOBILE(801, "管理员联系手机号信息必须录入"),
	ADMIN_INVALID_MAIL(802, "管理员邮箱信息必须录入");

	private final Integer code;
	private final String desc;

	MerchantResponseCode(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public static MerchantResponseCode getInstance(Integer code) {
		if (code != null) {
			for (MerchantResponseCode tmp : MerchantResponseCode.values()) {
				if (tmp.code.intValue() == code.intValue()) {
					return tmp;
				}
			}
		}
		return null;
	}

	public Integer code() {
		return code;
	}

	public String desc() {
		return desc;
	}
}
